Skip to content

Split persistent state on parts by shards#1100

Open
SmaGMan wants to merge 12 commits into
masterfrom
feature/split-persistent-w-raw-import-speed-up
Open

Split persistent state on parts by shards#1100
SmaGMan wants to merge 12 commits into
masterfrom
feature/split-persistent-w-raw-import-speed-up

Conversation

@SmaGMan

@SmaGMan SmaGMan commented Jun 17, 2026

Copy link
Copy Markdown
Member

Introduces the split of the persistent state on to 2^persistent_state_split_depth files by shards. It supports write/import from splitted files, exchange via RPC, backward compatibility with a single-file persistent state.

It writes persistent state metadata file indicating the split config even when no split required.

<block_id>.meta.json
---
{
  "split_depth": 2,
  "parts": ["0xa000000000000000", "0x2000000000000000"]
}

Final persistent state bundle will be:

<block_id>_part_0xa000000000000000.boc
<block_id>_part_0x2000000000000000.boc
<block_id>.boc
<block_id>.meta.json

If state does not contain accounts in some shard, no part file is generated for that shard.

Crash recovery:

  • write sequence: parts, metadata, main file
  • if main file does not exist, bundle is not finished
  • already written persistent state parts will be reused on the next attempt

Pull Request Checklist

NODE CONFIGURATION MODEL CHANGES

Added optional param. Default = 0

{
  "core_storage": {
    "persistent_state_split_depth": 2
  }
}

BLOCKCHAIN CONFIGURATION MODEL CHANGES

[None]


COMPATIBILITY

Fully compatible. Existing single-file persistent state treated as created with persistent_state_split_depth = 0.

SPECIAL DEPLOYMENT ACTIONS

[Not Required]


PERFORMANCE IMPACT

State 10kk.

  • persistent_state_split_depth = 2

write start: Jun 19 11:31
write stop: Jun 19 11:49
elapsed: 18 min
size: ~1.4G (each part by 350M)
  • persistent_state_split_depth = 0
write start: Jun 19 11:30
write stop: Jun 19 12:42
elapsed: 72 min
size: ~1.4G

TESTS

Unit Tests

Covered by:

  • split_persistent_bundle_paths_are_rejected_for_zerostate_import
  • persistent_state_meta_roundtrip
  • shard_state_part_file_name_parser_recognizes_only_parts
  • test_check_can_reuse_shard_state_part_files
  • cache_rejects_split_sidecars_without_metadata
  • persistent_state_writer_rejects_missing_absent_cell
  • split_persistent_shard_state_import_from_dump
  • overlay_server_split_persistent_state

Network Tests

[No coverage]

Manual Tests

Manual tests used
devnet5

  • deploy 10kk
  • init hack to write persistent on every key block on validator 2 and 3
  • make a small change in blockchain config to force key block
  • check persistent state creation

@SmaGMan SmaGMan requested review from 0xdeafbeef, Mododo and Rexagon June 17, 2026 13:28
@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown

🧪 Network Tests

To run network tests for this PR, use:

gh workflow run network-tests.yml -f pr_number=1100

Available test options:

  • Run all tests: gh workflow run network-tests.yml -f pr_number=1100
  • Run specific test: gh workflow run network-tests.yml -f pr_number=1100 -f test_selection=ping-pong

Test types: destroyable, ping-pong, one-to-many-internal-messages, fq-deploy, nft-index, persistent-sync

Results will be posted as workflow runs in the Actions tab.

@SmaGMan SmaGMan force-pushed the feature/split-persistent-w-raw-import-speed-up branch 2 times, most recently from bb2c98d to 96c829f Compare June 17, 2026 20:22
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 74.14311% with 430 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.35%. Comparing base (88996d8) to head (4d89ee0).

Files with missing lines Patch % Lines
core/src/block_strider/starter/cold_boot.rs 0.00% 152 Missing ⚠️
core/src/storage/persistent_state/tests.rs 76.94% 15 Missing and 56 partials ⚠️
core/src/storage/persistent_state/mod.rs 67.12% 30 Missing and 18 partials ⚠️
core/src/storage/shard_state/mod.rs 74.24% 20 Missing and 14 partials ⚠️
core/src/storage/shard_state/cell_storage/raw.rs 90.31% 16 Missing and 15 partials ⚠️
core/src/storage/shard_state/store_state_raw.rs 81.76% 12 Missing and 17 partials ⚠️
...src/storage/persistent_state/shard_state/writer.rs 90.09% 11 Missing and 9 partials ⚠️
core/src/block_strider/starter/starter_client.rs 0.00% 13 Missing ⚠️
core/src/blockchain_rpc/service.rs 84.44% 7 Missing ⚠️
block-util/src/dict.rs 89.65% 4 Missing and 2 partials ⚠️
... and 7 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1100      +/-   ##
==========================================
+ Coverage   60.22%   60.35%   +0.12%     
==========================================
  Files         473      474       +1     
  Lines       80541    82035    +1494     
  Branches    80541    82035    +1494     
==========================================
+ Hits        48507    49513    +1006     
- Misses      29712    30086     +374     
- Partials     2322     2436     +114     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@SmaGMan SmaGMan force-pushed the feature/split-persistent-w-raw-import-speed-up branch from 96c829f to 849cca2 Compare June 17, 2026 20:31
@SmaGMan SmaGMan requested review from pashinov and removed request for Mododo June 19, 2026 10:35
@SmaGMan SmaGMan marked this pull request as ready for review June 19, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants